package com.piggy.logi.sys.api.factory;

import com.piggy.logi.sys.api.RemoteLogiRoleService;
import com.piggy.common.core.domain.R;
import com.piggy.logi.sys.api.domain.LogiSysRole;
import com.piggy.logi.sys.api.domain.LogiSysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 角色服务降级处理
 *
 * @author shark
 */
@Component
public class RemoteLogiRoleFallbackFactory implements FallbackFactory<RemoteLogiRoleService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteLogiRoleFallbackFactory.class);

    @Override
    public RemoteLogiRoleService create(Throwable throwable) {
        log.error("角色服务调用失败:{}", throwable.getMessage());
        return new RemoteLogiRoleService()
        {
            @Override
            public R innerRemove(Long[] roleIds, String source) {
                return null;
            }

            @Override
            public R<LogiSysRole> getRoleByKey(String roleKey, String source) {
                return null;
            }

            @Override
            public R<List<LogiSysUser>> getRoleUsers(Long roleId, String source) {
                return null;
            }

            @Override
            public R innerAdd(LogiSysRole role, String source) {
                return null;
            }

            @Override
            public R innerEdit(LogiSysRole role, String source) {
                return null;
            }

            @Override
            public R innerDataScope(LogiSysRole role, String source) {
                return null;
            }

            @Override
            public R innerChangeStatus(LogiSysRole role, String source) {
                return null;
            }

            @Override
            public R<List<LogiSysRole>> queryRoleAll(Long mainDeptId, String source) {
                return null;
            }

            @Override
            public R<LogiSysRole> getById(Long roleId, String source) {
                return null;
            }
        };
    }
}
